<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include::head"></head>
<body class="gray-bg">
<div class="layui-anim layui-anim-upbit layui-fluid">
    <div class="layui-row layui-col-space15 table-search">
        <div class="layui-col-md12">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <th:block th:each="list : ${websiteDetails}">
                        <li th:if="${list.id == 'web-essential'}" class="layui-this" th:utext="${list.name}"></li>
                        <li th:if="${list.id == 'web-upload'}" th:utext="${list.name}"></li>
                        <li th:if="${list.id == 'web-mail'}"  th:utext="${list.name}"></li>
                    </th:block>
                </ul>
                <div class="layui-tab-content">
                    <th:block th:each="list : ${websiteDetails}">
                        <div th:if="${list.id == 'web-essential'}" class="layui-tab-item layui-show">
                            <form class="layui-form" action="">
                                <input type="hidden" th:value="${list.id}"  name="id">
                                <div class="layui-form-item">
                                    <label class="layui-form-label"><i class="jelly-identification">*</i>网站名称</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="title" th:value="${list.webEssential.title}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label"><i class="jelly-identification">*</i>网站域名</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="domainName" th:value="${list.webEssential.domainName}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">网站logo</label>
                                        <div class="layui-input-inline">
                                            <img style="width: 50px;height: 50px;" id="show-logo" th:src="${list.webEssential.logo}" />
                                            <input type="hidden" name="logo" id="logo" th:value="${list.webEssential.logo}" autocomplete="off" class="layui-input">
                                            <button type="button" class="layui-btn" id="button-logo"><i class="layui-icon"></i>上传图片</button>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">网站icon</label>
                                        <div class="layui-input-inline">
                                            <img style="width: 50px;height: 50px;" id="show-icon"  th:src="${list.webEssential.icon}" />
                                            <input type="hidden" name="icon" id="icon" th:value="${list.webEssential.icon}" autocomplete="off" class="layui-input">
                                            <button type="button" class="layui-btn" id="button-icon"><i class="layui-icon"></i>上传图片</button>
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">SEO标题</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="seoTitle" th:value="${list.webEssential.seoTitle}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">SEO关键词</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="seoKeyword" th:value="${list.webEssential.seoKeyword}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">SEO描述信息</label>
                                    <div class="layui-input-block">
                                        <textarea class="layui-textarea"  name="seoDescribe"  th:utext="${list.webEssential.seoDescribe}" ></textarea>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">ICP备案号</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="icpNumber" th:value="${list.webEssential.icpNumber}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">官方QQ</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="qq" th:value="${list.webEssential.qq}" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">电话</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="mobile" th:value="${list.webEssential.mobile}" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">传真</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="fax" th:value="${list.webEssential.fax}" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">地址</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="address" th:value="${list.webEssential.address}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">百度统计</label>
                                    <div class="layui-input-block">
                                        <textarea class="layui-textarea"  name="statistics"  th:utext="${list.webEssential.statistics}" ></textarea>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <button class="layui-btn" lay-submit="" lay-filter="demo1">确认修改</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div th:if="${list.id == 'web-upload'}"  class="layui-tab-item">
                                <form class="layui-form" action="">
                                    <input type="hidden" th:value="${list.id}"  name="id">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label"><i class="jelly-identification">*</i>上传状态</label>
                                        <div class="layui-input-block">
                                            <th:block th:each="value: ${diy['payment_type']}">
                                                <input th:if="${value.dictionaryRoute==list.isState}" type="radio" name="isState" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}"  checked  >
                                                <input th:if="${value.dictionaryRoute!=list.isState}" type="radio" name="isState" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}">
                                            </th:block>
                                        </div>
                                    </div>

                                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                                        <legend>OSS上传</legend>
                                    </fieldset>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">是否启用</label>
                                        <div class="layui-input-block">
                                            <th:block th:each="value: ${diy['payment_type']}">
                                                <input th:if="${value.dictionaryRoute==list.webUpload.isOSSState}" type="radio" name="isOSSState" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}"  checked  >
                                                <input th:if="${value.dictionaryRoute!=list.webUpload.isOSSState}" type="radio" name="isOSSState" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}">
                                            </th:block>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">地域节点</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="endpoint" th:value="${list.webUpload.endpoint}" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">Key</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="accessKeyId" th:value="${list.webUpload.accessKeyId}" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">KeySecret</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="accessKeySecret" th:value="${list.webUpload.accessKeySecret}" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">Bucket 域名</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="backetName" th:value="${list.webUpload.backetName}" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">上传文件夹</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="path" th:value="${list.webUpload.path}" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>

                                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                                        <legend>本地上传</legend>
                                    </fieldset>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">上传地址</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="localPath" th:value="${list.webUpload.localPath}" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <button class="layui-btn" lay-submit="" lay-filter="demo1">确认修改</button>
                                        </div>
                                    </div>

                                </form>

                        </div>
                        <div th:if="${list.id == 'web-mail'}"  class="layui-tab-item">
                            <form class="layui-form" action="">
                                <input type="hidden" th:value="${list.id}"  name="id">
                                <div class="layui-form-item">
                                    <label class="layui-form-label"><i class="jelly-identification">*</i>邮件状态</label>
                                    <div class="layui-input-block">
                                        <th:block th:each="value: ${diy['payment_type']}">
                                            <input th:if="${value.dictionaryRoute==list.isState}" type="radio" name="isState" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}"  checked  >
                                            <input th:if="${value.dictionaryRoute!=list.isState}" type="radio" name="isState" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}">
                                        </th:block>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">SMTP服务器地址</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="smtpUrl" th:value="${list.webMail.smtpUrl}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">SMTP端口号</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="smtpPortNumber" th:value="${list.webMail.smtpPortNumber}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">SSL/TLS加密</label>
                                    <div class="layui-input-block">
                                        <th:block th:each="value: ${diy['payment_type']}">
                                            <input th:if="${value.dictionaryRoute==list.webMail.isEncryption}" type="radio" name="isEncryption" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}"  checked  >
                                            <input th:if="${value.dictionaryRoute!=list.webMail.isEncryption}" type="radio" name="isEncryption" th:value="${value.dictionaryRoute}" th:title="${value.dictionaryName}">
                                        </th:block>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">SMTP用户名</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="smtpAccount" th:value="${list.webMail.smtpAccount}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">SMTP密码</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="smtpPassword" th:value="${list.webMail.smtpPassword}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">发信人地址</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="smtpUserAddres" th:value="${list.webMail.smtpUserAddres}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">发信人名称</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="smtpUserName" th:value="${list.webMail.smtpUserName}" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <button class="layui-btn" lay-submit="" lay-filter="demo1">确认修改</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </th:block>
                </div>
            </div>
        </div>
    </div>
</div>

<div th:include="include::onload"></div>
<script  th:inline="javascript">
    layui.use(['element','form','upload'], function(){
        var form = layui.form,
            upload = layui.upload,
            url = "/upload/image",
            element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
        //执行实例
        upload.render({
            elem: '#button-logo' //绑定元素
            ,url: url //上传接口
            ,"data": {
                "type": "logo"
            }
            ,done: function(date){
                //上传完毕回调
                $('#logo').val(date.result);
                $('#show-logo').attr('src',date.result);
            }
            ,error: function(err){
                Layer.showFailMsg(err.result);
            }
        });

        //执行实例
        upload.render({
            elem: '#button-icon' //绑定元素
            ,url: url //上传接口
            ,"data": {
                "type": "icon"
            }
            ,done: function(date){
                //上传完毕回调
                $('#icon').val(date.result);
                $('#show-icon').attr('src',date.result);
            }
            ,error: function(err){
                Layer.showFailMsg(err.result);
            }
        });

        //监听提交
        form.on('submit(demo1)', function(data){
            $.achieve.postRefresh("/admin/basics/website/update",data.field);
            return false;
        });

    });
</script>
</body>
</html>